diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py
index f5fdaa55ee..51a3de2dc2 100644
--- a/django/db/models/fields/related.py
+++ b/django/db/models/fields/related.py
@@ -528,6 +528,13 @@ class ForeignObject(RelatedField):
             frozenset(ut)
             for ut in self.remote_field.model._meta.unique_together
         })
+        # Check for UniqueConstraint in _meta.constraints
+        unique_constraints = {
+            frozenset(uc.fields)
+            for uc in self.remote_field.model._meta.constraints
+            if isinstance(uc, models.UniqueConstraint) and uc.condition is None
+        }
+        unique_foreign_fields.update(unique_constraints)
         foreign_fields = {f.name for f in self.foreign_related_fields}
         has_unique_constraint = any(u <= foreign_fields for u in unique_foreign_fields)
 
